package collections;

import java.util.Collection;
import java.util.Iterator;

public abstract class AQueue<T> implements Queueable<T>, Collection<T>{
	SingleNodeList <T> snl = new SingleNodeList<T>();
	Iterator<T> i;
	public void push (T e){
			snl.add(e);
	}
	public T pop(){
		if(i==null){
			i=snl.iterator();
			return pop();
		}else{
			T r=(i.hasNext())?i.next():null;
			i.remove();
			return r;
		}
	}
	public void clear(){
		snl=new SingleNodeList<T>();
	}
}
